<style lang="less">
  @import "./app-list.less";
</style>
<template>
    <div>
      
        <Row >        
                    <Row class="toolMarginTop">
                      <el-form :inline="true" :model="filters">
                        <el-button plain @click="appAdd" style="float:left;">应用注册</el-button>
                            <el-form-item style="float:right">
                              <el-button type="primary" v-on:click="getList">查询</el-button>
                            </el-form-item>
                            <el-form-item style="float:right">
                              <el-input v-model="filters.appCode" placeholder="应用编码"></el-input>
                            </el-form-item>
                            <el-form-item style="float:right">
                              <el-input v-model="filters.appName" placeholder="应用名称"></el-input>
                            </el-form-item>
                      </el-form>
                    </Row>                     
                <el-row class="tac  titleLineSymbolTwo">
                <el-col :span="4">
                    <h5></h5>                  
                    <el-menu default-active="2"  class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose">
                    <el-submenu index="1" >
                      <template slot="title">
                      <i class="el-icon-location"></i>
                      <span>市场</span>
                      </template>  
                      <el-menu-item index="item.marketCode" v-for="item in market" :key="item.marketCode" :value="item.marketCode" :label="item.marketName" ></el-menu-item>
                    </el-submenu>
                    </el-menu>  
                </el-col>
                <el-col :span="19" >
                  <el-table :data="tableData" highlight-current-row v-loading="listLoading" style="width: 100%"  >
                    <el-table-column prop="appName"  label="应用名称" width="180" >
                    </el-table-column>
                    <el-table-column prop="appCode" label="应用编码" width="180">
                    </el-table-column>
                    <el-table-column prop="market.marketName" label="市场">
                    </el-table-column>
                    <el-table-column prop="applicationType.className" label="应用分类">
                    </el-table-column>
                    <el-table-column prop="appSource" label="应用来源">
                    </el-table-column>
                    <el-table-column prop="createDate" label="创建时间">
                    </el-table-column>
                    <el-table-column prop="updateDate" label="最近更新时间">
                    </el-table-column>
                    <el-table-column fixed="right" label="操作" width="250">
                    <template slot-scope="scope">
                    <el-button  @click="appEdit(scope.$index, scope.row)" type="text" size="small">完善应用资料</el-button>
                    <el-button @click="versionEdit(scope.$index, scope.row)" type="text" size="small">版本信息</el-button>
                    </template>
                    </el-table-column>
                  </el-table>
                </el-col>              
                <el-col :span="24" class="toolbar marginTop10px">
                  <el-pagination layout="total, prev, pager, next, jumper" @current-change="handleCurrentPageChange"
                                  :current-page="pageNum" :page-size="pageSize" :total="total">
                  </el-pagination>
                </el-col>
                </el-row>
                <el-dialog title="完善资料" :visible.sync="editdialogVisible" :modal-append-to-body="false">
                  <el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editForm">
                  <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick" value="first">
                    <el-tab-pane label="基础信息" name="first">
                      <el-form-item label="应用编码" prop="appCode" >
                        <el-input v-model="editForm.appCode"  placeholder="应用编码"  ></el-input>
                      </el-form-item>
                      <el-form-item label="应用名称" prop="appName">
                        <el-input v-model="editForm.appName"  placeholder="应用名称"></el-input>
                      </el-form-item>
                      <el-form-item label="应用图标" prop="logoImage">
                        <el-input v-model="editForm.logoImage"  placeholder="应用图标"></el-input>
                      </el-form-item>
                      <el-form-item label="市   场 " prop="market"> 
                        <el-select v-model="editForm.market.marketName" placeholder="请选择">
                          <el-option  v-for="item in market" :key="item.marketCode" :value="item.marketCode" :label="item.marketName"></el-option>
                        </el-select>
                      </el-form-item>
                      <el-form-item label="应用分类"  prop="appType">
                        <el-select  v-model="editForm.applicationType.className"  placeholder="请选择">
                        <el-option v-for="item in clazz" :key="item.classCode" :value="item.classCode" :label="item.className"></el-option> 
                        </el-select>
                      </el-form-item>
                      <el-form-item label="开发商">
                        <el-input  v-model="editForm.developer" placeholder="开发商"></el-input>
                      </el-form-item>
                      <el-form-item label="是否推荐"  prop="appType">
                        <el-select v-model="editForm.recommend" placeholder="请选择">
                          <el-option label="非默认推荐" value="0"></el-option>
                          <el-option label="默认推荐" value="1"></el-option>
                          <el-option label="手工推荐" value="2"></el-option>
                        </el-select>
                      </el-form-item >
                      <el-form-item label="排序">
                        <el-input v-model="editForm.sort" placeholder="排序"></el-input>
                      </el-form-item>
                      <el-form-item label="应用介绍">
                        <el-input   type="textarea" v-model="editForm.remark" placeholder="应用介绍"></el-input>
                      </el-form-item>
                    </el-tab-pane>
                    <el-tab-pane label="扩展信息" name="second">
                      <el-form :model="extendForm" label-width="130px" :rules="extendFormRules" ref="extendForm">
                        <!-- <el-form-item label="适用终端">
                          <template>
                            <el-checkbox-group v-model="checkedSystems1" :min="1" :max="2">
                              <el-checkbox v-for="system in systems" :label="system" :key="system">{{system}}</el-checkbox>
                            </el-checkbox-group>
                          </template>
                        </el-form-item> -->
                        <el-form-item label="适用终端"  prop="appTerminal">
                          <el-checkbox-group v-model="extendForm.appTermianl"  :min="1" :max="2">
                            <el-checkbox label="1" >Web</el-checkbox>
                            <el-checkbox label="2" >IOS</el-checkbox>
                            <el-checkbox label="3" >Android</el-checkbox>
                            <el-checkbox label="4" >IOS+Android</el-checkbox>
                          </el-checkbox-group>
                        </el-form-item>
                        <!-- <el-form-item >
                          <template v-for="checkb in checkBox" >
                          <input type='checkbox' name='checkboxinput' class='input-checkbox' v-model='checkBox' value='{{checkb.index}}'>{{checkb.termianl}}</input>
                          </template>
                        </el-form-item> -->
                        <el-form-item label="访问管控">
                          <el-radio-group v-model="extendForm.accessControl">
                            <el-radio class="radio" :label="1">是</el-radio>
                            <el-radio class="radio" :label="0">否</el-radio>
                          </el-radio-group>
                        </el-form-item>
                        <el-form-item label="是否启用">
                          <el-radio-group v-model="extendForm.isEnable">
                            <el-radio class="radio" :label="1">是</el-radio>
                            <el-radio class="radio" :label="0">否</el-radio>
                          </el-radio-group>
                        </el-form-item>
                        <el-form-item label="是否默认系统应用">
                          <el-radio-group v-model="extendForm.isDefault">
                            <el-radio class="radio" :label="1">是</el-radio>
                            <el-radio class="radio" :label="0">否</el-radio>
                          </el-radio-group>
                        </el-form-item>
                        <el-form-item label="是否需要预安装">
                          <el-radio-group v-model="extendForm.isPreInstall">
                            <el-radio class="radio" :label="1">是</el-radio>
                            <el-radio class="radio" :label="0">否</el-radio>
                          </el-radio-group>
                        </el-form-item>
                        <el-form-item label="附件">
                          <!-- <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/" :on-preview="handlePreview" :on-remove="handleRemove"
                          :before-remove="beforeRemove"  multiple  :limit="3"  :on-exceed="handleExceed" :file-list="fileList">
                          <el-button size="small" type="primary">点击上传</el-button> -->
                          <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/pngk文件，且不超过500kb</div> -->
                        <!-- </el-upload> -->
                        </el-form-item>
                        <el-form-item label="图片"></el-form-item>
                      </el-form>
                    </el-tab-pane>
                    <el-tab-pane label="Api接口信息" name="third">
                      <el-row class="tac">
                        <el-col  >
                          <el-button plain @click="apiAdd">新增Api接口</el-button>
                          <el-form :model="apiTab" ref="apiTab"  >
                          <el-table :data="apiTableList" highlight-current-row v-loading="apiListLoading" style="width: 100%"  >
                            <el-table-column prop="apiName"  label="API接口名称">
                            </el-table-column>
                            <el-table-column prop="apiAddrss" label="API接口地址">
                            </el-table-column>
                            <el-table-column prop="gatewayAddrss" label="网关地址">
                            </el-table-column>
                            <el-table-column prop="updateDate" label="修改时间">
                            </el-table-column>
                            <el-table-column fixed="right" label="操作" width="90">
                            <template slot-scope="scope">
                              <!-- <el-button  @click="tabEdit(scope.$index, scope.row)" type="text" size="small">编辑</el-button> -->
                              <!-- <el-button  @click="modal16 = true" type="text">编辑</el-button> -->
                              <el-button  @click="tabEdit(scope.$index, scope.row)" type="text">编辑</el-button>
                              <el-button @click="apiDelete(scope.$index, scope.row)" type="text" size="small">删除</el-button>
                            </template>
                            </el-table-column>
                          </el-table>
                          </el-form>
                        </el-col>              
                        <el-col :span="24" class="toolbar">
                          <el-pagination layout="total, prev, pager, next, jumper" @current-change="handleCurrentAPiPageChange"
                                          :current-page="apiPageNum" :page-size="apiPageSize" :total="apiTotal">
                          </el-pagination>
                        </el-col>
                        </el-row>
                    </el-tab-pane>
                  </el-tabs>
                  </el-form>
                  <span slot="footer" class="dialog-footer">
                      <el-button @click="editdialogVisible = false">取 消</el-button>
                      <el-button type="primary" @click.native="editSubmit" :loading="editLoading" >确 定</el-button>
                  </span>
                </el-dialog>
                    <el-dialog title="版本信息"  :visible.sync="versionDialogVisible" :modal-append-to-body="false">
                      <el-form :model="versionTab" ref="versionTab"  >
                      <el-tabs v-model="activeTab" @tab-click="handleClick">
                          <el-tab-pane label="Web" name="first">
                            <el-col  >
                               <el-form :inline="true" :model="filters2">
                                <el-form-item >
                                <el-button plain @click="webAdd">新增Web版本</el-button>
                                </el-form-item>
                                <el-form-item style="float:right">
                                  <el-button type="primary" v-on:click="webList">查询</el-button>
                                </el-form-item>
                                <el-form-item style="float:right">
                                <el-input  v-model="filters2.version"  class="demo-input-suffix" placeholder="版本号"></el-input>
                                </el-form-item>

                               </el-form>
                              <el-table  :data="webTableList" highlight-current-row v-loading="webListLoading"   >
                                <el-table-column type="selection" >
                                </el-table-column>
                                <el-table-column prop="appName"  label="应用名称" >
                                </el-table-column>
                                <el-table-column prop="appCode" label="应用编码" >
                                </el-table-column>
                                <el-table-column prop="versionType" label="版本类型" :formatter="formatVersion">
                                </el-table-column>
                                <el-table-column prop="version" label="版本号">
                                </el-table-column>
                                <el-table-column prop="currentVersion" label="当前版本" :formatter="formatCurrentVersion">
                                </el-table-column>
                                <el-table-column prop="creater" label="创建人">
                                </el-table-column>
                                <el-table-column prop="updateDate" label="修改时间">
                                </el-table-column>
                                <el-table-column fixed="right" label="操作" width="150">
                                <template slot-scope="scope">
                                <el-button @click="view(scope.$index, scope.row)" type="text" size="small">查看</el-button>
                                <!-- <el-button type="text" size="small">编辑</el-button> -->
                                
                                <el-button @click="putDown(scope.$index, scope.row)" v-if="scope.row.currentVersion === 1" type="text" size="small">下架</el-button>
                                <el-button @click="check(scope.$index, scope.row)" type="text" size="small" v-else>设为当前版本</el-button>
                                </template>
                                </el-table-column>
                           </el-table>
                          </el-col>
                          <el-col :span="24" class="toolbar">
                            <el-pagination layout="total, prev, pager, next, jumper" @current-change="handleCurrentWebPageChange"
                                            :current-page="webPageNum" :page-size="pageSize" :total="webTotal">
                            </el-pagination>
                          </el-col>
                          </el-tab-pane>
                          <el-tab-pane label="IOS" name="second">
                            <el-col  >
                              <el-form :inline="true" :model="filters2">
                                <el-form-item >
                                <el-button plain @click="iosAdd">新增IOS版本</el-button>
                                </el-form-item>
                                <el-form-item style="float:right">
                                  <el-button type="primary" v-on:click="iosList">查询</el-button>
                                </el-form-item>
                                <el-form-item style="float:right" >
                                <el-input  v-model="filters3.version"  class="demo-input-suffix" placeholder="版本号"></el-input>
                                </el-form-item>
                              </el-form>
                              <el-table :data="iosTableList" highlight-current-row v-loading="iosListLoading"   >
                                <el-table-column type="selection" >
                                </el-table-column>
                                <el-table-column prop="appName"  label="应用名称" >
                                </el-table-column>
                                <el-table-column prop="appCode" label="应用编码" >
                                </el-table-column>
                                <el-table-column prop="versionType" label="版本类型" :formatter="formatVersion">
                                </el-table-column>
                                <el-table-column prop="version" label="版本号">
                                </el-table-column>
                                <el-table-column prop="currentVersion" label="当前版本" :formatter="formatCurrentVersion">
                                </el-table-column>
                                <el-table-column prop="creater" label="创建人">
                                </el-table-column>
                                <el-table-column prop="updateDate" label="修改时间">
                                </el-table-column>
                                <el-table-column fixed="right" label="操作" width="150">
                                <template slot-scope="scope">
                                <el-button @click="view(scope.$index, scope.row)" type="text" size="small">查看</el-button>
                                <el-button @click="putDown(scope.$index, scope.row)" v-if="scope.row.currentVersion === 1" type="text" size="small">下架</el-button>
                                <el-button @click="check(scope.$index, scope.row)" type="text" size="small" v-else>设为当前版本</el-button>
                                <!-- <el-button type="text" size="small">编辑</el-button> -->
                                </template>
                                </el-table-column>
                           </el-table>
                          </el-col>
                          <el-col  class="toolbar">
                            <el-pagination layout="total, prev, pager, next, jumper" @current-change="handleCurrentPageChange"
                                            :current-page="pageNum" :page-size="pageSize" :total="iosTotal">
                            </el-pagination>
                          </el-col>
                          </el-tab-pane>
                          <el-tab-pane label="Android" name="third">
                            <el-col  >
                              <el-form :inline="true" :model="filters2">
                                <el-form-item >
                                <el-button plain @click="androidAdd">新增Android版本</el-button>
                                </el-form-item>
                                <el-form-item style="float:right">
                                  <el-button type="primary" v-on:click="androidList">查询</el-button>
                                </el-form-item>
                                <el-form-item style="float:right">
                                <el-input  v-model="filters4.version"  class="demo-input-suffix" placeholder="版本号"></el-input>
                                </el-form-item>
                              </el-form>
                              <el-table :data="androidTableList" highlight-current-row v-loading="androidListLoading"  >
                                <el-table-column type="selection" >
                                </el-table-column>
                                <el-table-column prop="appName"  label="应用名称" >
                                </el-table-column>
                                <el-table-column prop="appCode" label="应用编码" >
                                </el-table-column>
                                <el-table-column prop="versionType" label="版本类型" :formatter="formatVersion">
                                </el-table-column>
                                <el-table-column prop="version" label="版本号">
                                </el-table-column>
                                <el-table-column prop="currentVersion" label="当前版本" :formatter="formatCurrentVersion">
                                </el-table-column>
                                <el-table-column prop="creater" label="创建人">
                                </el-table-column>
                                <el-table-column prop="updateDate" label="修改时间">
                                </el-table-column>
                                <el-table-column fixed="right" label="操作" width="150">
                                <template slot-scope="scope">
                                <el-button @click="view(scope.$index, scope.row)" type="text" size="small">查看</el-button>
                                <el-button @click="putDown(scope.$index, scope.row)" v-if="scope.row.currentVersion === 1" type="text" size="small">下架</el-button>
                                <el-button @click="check(scope.$index, scope.row)" type="text" size="small" v-else>设为当前版本</el-button>
                                <!-- <el-button type="text" size="small">设为当前版本</el-button> -->
                                </template>
                                </el-table-column>
                           </el-table>
                          </el-col>
                          <el-col :span="24" class="toolbar">
                            <el-pagination layout="total, prev, pager, next, jumper" @current-change="handleCurrentPageChange"
                                            :current-page="pageNum" :page-size="pageSize" :total="androidTotal">
                            </el-pagination>
                          </el-col>
                          </el-tab-pane>
                      </el-tabs>
                      </el-form>
                      <span slot="footer" class="dialog-footer">
                          <el-button @click="versionDialogVisible = false">取 消</el-button>
                          <el-button type="primary" @click="versionDialogVisible = false">确 定</el-button>
                      </span>
                    </el-dialog>
             <!-- 新增弹框-->   
            <el-dialog  title="应用注册" :visible.sync="appDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm">
                  <el-form-item label="市   场 " prop="appMarket"> 
                    <el-select  placeholder="请选择" v-model="addForm.appMarket">
                      <el-option  v-for="item in market" :key="item.marketCode" :value="item.marketCode" :label="item.marketName"></el-option>
                    </el-select>
                  </el-form-item>
                    <el-form-item label="应用分类"  prop="appType">
                    <el-select  placeholder="请选择" v-model="addForm.appType">
                      <el-option v-for="item in clazz" :key="item.classCode" :value="item.classCode" :label="item.className"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="应用名称" prop="appName">
                    <el-input v-model="addForm.appName"></el-input>
                  </el-form-item>
                  <el-form-item label="应用编码" prop="appCode">
                    <el-input v-model="addForm.appCode"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="appDialogVisible = false">关 闭</el-button>
                <el-button type="primary" @click.native="addSubmit" :loading="addLoading">保 存</el-button>
              </div >
            </el-dialog>            
             <!-- 新增api弹框-->   
            <el-dialog  title="新增API接口" :visible.sync="apiDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="apiForm" label-width="120px" :rules="apiFormRules" ref="apiForm">
                  <el-form-item label="API接口名称" prop="apiName">
                    <el-input v-model="apiForm.apiName"></el-input>
                  </el-form-item>
                  <el-form-item label="API接口地址" prop="apiAddrss">
                    <el-input v-model="apiForm.apiAddrss"></el-input>
                  </el-form-item>
                  <el-form-item label="网关地址" prop="gatewayAddrss">
                    <el-input v-model="apiForm.gatewayAddrss"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="apiDialogVisible = false">关 闭</el-button>
                <el-button type="primary" @click.native="saveApi" :loading="addLoading">保 存</el-button>
              </div >
            </el-dialog>  
            <!-- 编辑api -->
            <!-- <el-dialog  title="编辑" :visible.sync="apiEditDialogVisible" :modal-append-to-body="false" width="30%" center> -->
               <Modal v-model="modal16" title="编辑"  width='30%'>
               <el-form :model="apiEditForm" label-width="120px"   ref="apiEditForm">
                  <el-form-item label="API接口名称" prop="apiName">
                    <el-input v-model="apiEditForm.apiName"></el-input>
                  </el-form-item>
                  <el-form-item label="API接口地址" prop="apiAddrss">
                    <el-input v-model="apiEditForm.apiAddrss"></el-input>
                  </el-form-item>
                  <el-form-item label="网关地址" prop="gatewayAddrss">
                    <el-input v-model="apiEditForm.gatewayAddrss"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="modal16 = false">关 闭</el-button>
                <el-button type="primary" @click.native="apiEditSubmit" :loading="addLoading">保 存</el-button>
              </div >
               </Modal>
            <!-- </el-dialog>   -->
            <!-- 新增Web版本信息--> 
            <el-dialog  title="新增WEB类版本信息" :visible.sync="webDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="webForm" label-width="120px" :rules="webFormRules" ref="webForm">
                  <el-form-item label="版本号" prop="version">
                    <el-input v-model="webForm.version"><template slot="prepend">v</template></el-input>
                  </el-form-item>
                  <el-form-item label="默认程序包">
                    <el-radio-group v-model="webForm.新增WEB类版本信息">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="窗口状态"  prop="winType">
                    <el-select v-model="webForm.winType" placeholder="是否推荐">
                      <el-option label="最大化" value="0"></el-option>
                      <el-option label="横向布局" value="1"></el-option>
                      <el-option label="纵向布局" value="2"></el-option>
                    </el-select>
                  </el-form-item >
                  <el-form-item label="是否依赖云">
                    <el-radio-group v-model="webForm.isRelyOnColud">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="URL地址" prop="accessUrl">
                    <el-input v-model="webForm.accessUrl"></el-input>
                  </el-form-item>
                  <el-form-item label="待办数地址" prop="urlNum">
                    <el-input v-model="webForm.urlNum"></el-input>
                  </el-form-item>
                  <el-form-item label="描述" prop="remark">
                    <el-input type="textarea" v-model="webForm.remark"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="webDialogVisible = false">关 闭</el-button>
                <el-button type="primary" @click="webConfirm" :loading="addLoading">提交发布</el-button>
                <el-button type="primary" @click.native="saveWeb" :loading="addLoading">保 存</el-button>
              </div >
            </el-dialog>   
            <!-- 查看Web版本信息--> 
            <el-dialog  title="版本信息" :visible.sync="webDetailDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="webDetailForm" label-width="120px" :rules="webFormRules" ref="webForm">
                  <el-form-item label="版本号" prop="version">
                    <el-input v-model="webDetailForm.version"><template slot="prepend">v</template></el-input>
                  </el-form-item>
                  <el-form-item label="默认程序包">
                    <el-radio-group v-model="webDetailForm.defaultPackage">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="窗口状态"  prop="winType">
                    <el-select v-model="webDetailForm.winType" placeholder="是否推荐">
                      <el-option label="最大化" value="0"></el-option>
                      <el-option label="横向布局" value="1"></el-option>
                      <el-option label="纵向布局" value="2"></el-option>
                    </el-select>
                  </el-form-item >
                  <el-form-item label="是否依赖云">
                    <el-radio-group v-model="webDetailForm.isRelyOnColud">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="URL地址" prop="accessUrl">
                    <el-input v-model="webDetailForm.accessUrl"></el-input>
                  </el-form-item>
                  <el-form-item label="待办数地址" prop="urlNum">
                    <el-input v-model="webDetailForm.urlNum"></el-input>
                  </el-form-item>
                  <el-form-item label="描述" prop="remark">
                    <el-input type="textarea" v-model="webDetailForm.remark"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="webDetailDialogVisible = false">关 闭</el-button>
              </div >
            </el-dialog>   
            <!-- Web版本信息确认--> 
            <el-dialog  title="版本信息确认" :visible.sync="webConfirmDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="webConfirmForm" label-width="120px"  ref="webConfirmForm">
                  <el-form-item label="应用编码" prop="appCode">
                    <el-input v-model="webConfirmForm.appCode"></el-input>
                  </el-form-item>
                  <el-form-item label="应用名称" prop="appName">
                    <el-input v-model="webConfirmForm.appName"></el-input>
                  </el-form-item>
                  <el-form-item label="LOGO" prop="logoImage">
                    <el-input v-model="webConfirmForm.logoImage"></el-input>
                  </el-form-item>
                  <el-form-item label="市场" prop="appMarket">
                    <el-input v-model="webConfirmForm.appMarket"></el-input>
                  </el-form-item>
                  <el-form-item label="应用分类" prop="appType">
                    <el-input v-model="webConfirmForm.appType"></el-input>
                  </el-form-item>
                  <el-form-item label="应用介绍" prop="remark">
                    <el-input v-model="webConfirmForm.remark"></el-input>
                  </el-form-item>
                  <el-form-item label="上传附件" prop="attachment">
                  </el-form-item>
                  <el-form-item label="版本号" prop="version">
                    <el-input v-model="webConfirmForm.version"></el-input>
                  </el-form-item>
                  <el-form-item label="默认程序包">
                    <el-radio-group v-model="webConfirmForm.installPackage">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="窗口状态" prop="winType">
                    <el-input v-model="webConfirmForm.winType"></el-input>
                  </el-form-item>
                  <el-form-item label="是否依赖云">
                    <el-radio-group v-model="webConfirmForm.isRelyOnColud">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="入口地址" prop="accessUrl">
                    <el-input v-model="webConfirmForm.accessUrl"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="webConfirmDialogVisible = false">关 闭</el-button>
                <el-button type="primary" @click.native="toPublish(webConfirmForm.versionType)"  :loading="publishLoading">确认发布</el-button>
              </div >
            </el-dialog>   
            <!-- 新增IOS版本信息--> 
            <el-dialog  title="新增IOS类版本信息" :visible.sync="iosDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="iosForm" label-width="120px" :rules="iosFormRules" ref="iosForm">
                  <el-form-item label="版本号" prop="version">
                    <el-input v-model="iosForm.version"><template slot="prepend">v</template></el-input>
                  </el-form-item>
                  <el-form-item label="是否云编译">
                    <el-radio-group v-model="iosForm.compile">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="强制更新">
                    <el-radio-group v-model="iosForm.forceUpdate">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="是否静默安装">
                    <el-radio-group v-model="iosForm.isDefaultInstall">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="验证类型"  prop="validateType">
                    <el-select v-model="iosForm.validateType" placeholder="是否推荐">
                      <el-option label="单点登录验证" value="0"></el-option>
                      <el-option label="不验证" value="1"></el-option>
                    </el-select>
                  </el-form-item >
                  <el-form-item label="开发框架类型"  prop="frameType">
                    <el-select v-model="iosForm.frameType" placeholder="是否推荐">
                      <el-option label="原生开发" value="0"></el-option>
                      <el-option label="BingoTouch" value="1"></el-option>
                      <el-option label="标准WEB程序" value="2"></el-option>
                    </el-select>
                  </el-form-item >
                  <el-form-item label="安装包路径" prop="installPackageUrl">
                    <el-input v-model="iosForm.installPackageUrl"></el-input>
                  </el-form-item>
                  <el-form-item label="安装包">
                  </el-form-item>
                  <el-form-item label="安装包大小" prop="installPackageSize">
                    <el-input v-model="iosForm.installPackageSize"></el-input>
                  </el-form-item>
                  <el-form-item label="入口地址" prop="accessUrl">
                    <el-input v-model="iosForm.accessUrl"></el-input>
                  </el-form-item>
                  <el-form-item label="启动配置项" prop="startupConfig">
                    <el-input v-model="iosForm.startupConfig"></el-input>
                  </el-form-item>
                  <el-form-item label="扩展配置" prop="extendConfig">
                    <el-input v-model="iosForm.extendConfig"></el-input>
                  </el-form-item>
                  <el-form-item label="描述" prop="remark">
                    <el-input type="textarea" v-model="iosForm.remark"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="iosDialogVisible = false">关 闭</el-button>
                <el-button type="primary" @click="iosConfirm" :loading="addLoading">提交发布</el-button>
                <el-button type="primary" @click.native="saveIOS" :loading="addLoading">保 存</el-button>
              </div >
            </el-dialog>   
            <!-- 查看IOS版本信息--> 
            <el-dialog  title="版本信息" :visible.sync="iosDetailDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="iosDetailForm" label-width="120px" :rules="iosFormRules" ref="iosForm">
                  <el-form-item label="版本号" prop="version">
                    <el-input v-model="iosDetailForm.version"><template slot="prepend">v</template></el-input>
                  </el-form-item>
                  <el-form-item label="是否云编译">
                    <el-radio-group v-model="iosDetailForm.compile">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="强制更新">
                    <el-radio-group v-model="iosDetailForm.forceUpdate">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="是否静默安装">
                    <el-radio-group v-model="iosDetailForm.isDefaultInstall">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="验证类型"  prop="validateType">
                    <el-select v-model="iosDetailForm.recommend" placeholder="是否推荐">
                      <el-option label="单点登录验证" value="0"></el-option>
                      <el-option label="不验证" value="1"></el-option>
                    </el-select>
                  </el-form-item >
                  <el-form-item label="开发框架类型"  prop="frameType">
                    <el-select v-model="iosDetailForm.recommend" placeholder="是否推荐">
                      <el-option label="原生开发" value="0"></el-option>
                      <el-option label="BingoTouch" value="1"></el-option>
                      <el-option label="标准WEB程序" value="2"></el-option>
                    </el-select>
                  </el-form-item >
                  <el-form-item label="安装包路径" prop="installPackageUrl">
                    <el-input v-model="iosDetailForm.apiAddrss"></el-input>
                  </el-form-item>
                  <el-form-item label="安装包">
                  </el-form-item>
                  <el-form-item label="安装包大小" prop="installPackageSize">
                    <el-input v-model="iosDetailForm.installPackageSize"></el-input>
                  </el-form-item>
                  <el-form-item label="入口地址" prop="accessUrl">
                    <el-input v-model="iosDetailForm.accessUrl"></el-input>
                  </el-form-item>
                  <el-form-item label="启动配置项" prop="startupConfig">
                    <el-input v-model="iosDetailForm.startupConfig"></el-input>
                  </el-form-item>
                  <el-form-item label="扩展配置" prop="extendConfig">
                    <el-input v-model="iosDetailForm.extendConfig"></el-input>
                  </el-form-item>
                  <el-form-item label="描述" prop="remark">
                    <el-input type="textarea" v-model="iosDetailForm.remark"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="iosDetailDialogVisible = false">关 闭</el-button>
              </div >
            </el-dialog>   
            <!-- IOS版本信息确认--> 
            <el-dialog  title="版本信息确认" :visible.sync="iosConfirmDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="iosConfirmForm" label-width="120px"  ref="iosConfirmForm">
                  <el-form-item label="应用编码" prop="appCode">
                    <el-input v-model="iosConfirmForm.appCode"></el-input>
                  </el-form-item>
                  <el-form-item label="应用名称" prop="appName">
                    <el-input v-model="iosConfirmForm.appName"></el-input>
                  </el-form-item>
                  <el-form-item label="LOGO" prop="logoImage">
                    <el-input v-model="iosConfirmForm.logoImage"></el-input>
                  </el-form-item>
                  <el-form-item label="市场" prop="appMarket">
                    <el-input v-model="iosConfirmForm.appMarket"></el-input>
                  </el-form-item>
                  <el-form-item label="应用分类" prop="appType">
                    <el-input v-model="iosConfirmForm.appType"></el-input>
                  </el-form-item>
                  <el-form-item label="应用介绍" prop="remark">
                    <el-input v-model="iosConfirmForm.remark"></el-input>
                  </el-form-item>
                  <el-form-item label="上传附件" prop="attachment">
                  </el-form-item>
                  <el-form-item label="版本号" prop="version">
                    <el-input v-model="iosConfirmForm.version"></el-input>
                  </el-form-item>
                  <el-form-item label="程序包/安装包路径">
                  </el-form-item>
                  <el-form-item label="入口地址" prop="version">
                    <el-input v-model="iosConfirmForm.version"></el-input>
                  </el-form-item>
                  <el-form-item label="安全检查报告" prop="version">
                    <el-input v-model="iosConfirmForm.version"></el-input>
                  </el-form-item>
                  <el-form-item label="查看" prop="version">
                    <el-input v-model="iosConfirmForm.version"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="iosConfirmDialogVisible = false">关 闭</el-button>
                <el-button type="primary" @click.native="toPublish(iosConfirmForm.versionType)"  :loading="publishLoading">确认发布</el-button>
              </div >
            </el-dialog> 
            <!-- 新增Android版本信息--> 
            <el-dialog  title="新增Android类版本信息" :visible.sync="androidDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="androidForm" label-width="120px" :rules="androidFormRules" ref="androidForm">
                  <el-form-item label="版本号" prop="version">
                    <el-input v-model="androidForm.version"><template slot="prepend">v</template></el-input>
                  </el-form-item>
                  <el-form-item label="是否云编译">
                    <el-radio-group v-model="androidForm.compile">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="强制更新">
                    <el-radio-group v-model="androidForm.forceUpdate">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="是否静默安装">
                    <el-radio-group v-model="androidForm.isDefaultInstall">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="验证类型"  prop="validateType">
                    <el-select v-model="androidForm.validateType" placeholder="验证类型">
                      <el-option label="单点登录验证" value="0"></el-option>
                      <el-option label="不验证" value="1"></el-option>
                    </el-select>
                  </el-form-item >
                  <el-form-item label="开发框架类型"  prop="frameType">
                    <el-select v-model="androidForm.frameType" placeholder="开发框架类型">
                      <el-option label="原生开发" value="0"></el-option>
                      <el-option label="BingoTouch" value="1"></el-option>
                      <el-option label="标准WEB程序" value="2"></el-option>
                    </el-select>
                  </el-form-item >
                  <el-form-item label="安装包路径" prop="installPackageUrl">
                    <el-input v-model="androidForm.installPackageUrl"></el-input>
                  </el-form-item>
                  <el-form-item label="安装包">
                  </el-form-item>
                  <el-form-item label="安装包大小" prop="installPackageSize">
                    <el-input v-model="androidForm.installPackageSize"></el-input>
                  </el-form-item>
                  <el-form-item label="入口地址" prop="gatewayAddrss">
                    <el-input v-model="androidForm.gatewayAddrss"></el-input>
                  </el-form-item>
                  <el-form-item label="启动配置项" prop="startupConfig">
                    <el-input v-model="androidForm.startupConfig"></el-input>
                  </el-form-item>
                  <el-form-item label="扩展配置" prop="extendConfig">
                    <el-input v-model="androidForm.extendConfig"></el-input>
                  </el-form-item>
                  <el-form-item label="描述" prop="remark">
                    <el-input type="textarea" v-model="androidForm.remark"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="androidDialogVisible = false">关 闭</el-button>
                <el-button type="primary" @click="androidConfirm" :loading="addLoading">提交发布</el-button>
                <el-button type="primary" @click.native="saveAndroid" :loading="addLoading">保 存</el-button>
              </div >
            </el-dialog>   
            <!-- 查看Android版本信息--> 
            <el-dialog  title="版本信息" :visible.sync="androidDetailDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="androidDetailForm" label-width="120px" :rules="androidFormRules" ref="androidForm">
                  <el-form-item label="版本号" prop="version">
                    <el-input v-model="androidDetailForm.version"><template slot="prepend">v</template></el-input>
                  </el-form-item>
                  <el-form-item label="是否云编译">
                    <el-radio-group v-model="androidDetailForm.compile">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="强制更新">
                    <el-radio-group v-model="androidDetailForm.forceUpdate">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="是否静默安装">
                    <el-radio-group v-model="androidDetailForm.isDefaultInstall">
                      <el-radio class="radio" :label="1">是</el-radio>
                      <el-radio class="radio" :label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="验证类型"  prop="validateType">
                    <el-select v-model="androidDetailForm.validateType" placeholder="验证类型">
                      <el-option label="单点登录验证" value="0"></el-option>
                      <el-option label="不验证" value="1"></el-option>
                    </el-select>
                  </el-form-item >
                  <el-form-item label="开发框架类型"  prop="frameType">
                    <el-select v-model="androidDetailForm.frameType" placeholder="开发框架类型">
                      <el-option label="原生开发" value="0"></el-option>
                      <el-option label="BingoTouch" value="1"></el-option>
                      <el-option label="标准WEB程序" value="2"></el-option>
                    </el-select>
                  </el-form-item >
                  <el-form-item label="安装包路径" prop="installPackageUrl">
                    <el-input v-model="androidDetailForm.installPackageUrl"></el-input>
                  </el-form-item>
                  <el-form-item label="安装包">
                  </el-form-item>
                  <el-form-item label="安装包大小" prop="installPackageSize">
                    <el-input v-model="androidDetailForm.installPackageSize"></el-input>
                  </el-form-item>
                  <el-form-item label="入口地址" prop="gatewayAddrss">
                    <el-input v-model="androidDetailForm.gatewayAddrss"></el-input>
                  </el-form-item>
                  <el-form-item label="启动配置项" prop="startupConfig">
                    <el-input v-model="androidDetailForm.startupConfig"></el-input>
                  </el-form-item>
                  <el-form-item label="扩展配置" prop="extendConfig">
                    <el-input v-model="androidDetailForm.extendConfig"></el-input>
                  </el-form-item>
                  <el-form-item label="描述" prop="remark">
                    <el-input type="textarea" v-model="androidDetailForm.remark"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="androidDetailDialogVisible = false">关 闭</el-button>
              </div >
            </el-dialog>   
            <!-- android版本信息确认--> 
            <el-dialog  title="版本信息确认" :visible.sync="androidConfirmDialogVisible" :modal-append-to-body="false" width="30%" center>
               <el-form :model="androidConfirmForm" label-width="120px"  ref="androidConfirmForm">
                  <el-form-item label="应用编码" prop="appCode">
                    <el-input v-model="androidConfirmForm.appCode"></el-input>
                  </el-form-item>
                  <el-form-item label="应用名称" prop="appName">
                    <el-input v-model="androidConfirmForm.appName"></el-input>
                  </el-form-item>
                  <el-form-item label="LOGO" prop="logoImage">
                    <el-input v-model="androidConfirmForm.logoImage"></el-input>
                  </el-form-item>
                  <el-form-item label="市场" prop="appMarket">
                    <el-input v-model="androidConfirmForm.appMarket"></el-input>
                  </el-form-item>
                  <el-form-item label="应用分类" prop="appType">
                    <el-input v-model="androidConfirmForm.appType"></el-input>
                  </el-form-item>
                  <el-form-item label="应用介绍" prop="remark">
                    <el-input v-model="androidConfirmForm.remark"></el-input>
                  </el-form-item>
                  <el-form-item label="上传附件" prop="attachment">
                  </el-form-item>
                  <el-form-item label="版本号" prop="version">
                    <el-input v-model="androidConfirmForm.version"></el-input>
                  </el-form-item>
                  <el-form-item label="程序包/安装包路径">
                  </el-form-item>
                  <el-form-item label="入口地址" prop="version">
                    <el-input v-model="androidConfirmForm.version"></el-input>
                  </el-form-item>
                  <el-form-item label="安全检查报告" prop="version">
                    <el-input v-model="androidConfirmForm.version"></el-input>
                  </el-form-item>
                  <el-form-item label="查看" prop="version">
                    <el-input v-model="androidConfirmForm.version"></el-input>
                  </el-form-item>
               </el-form>             
              <div  slot="footer" class="dialog-footer">
                <el-button @click="androidConfirmDialogVisible = false">关 闭</el-button>
                <el-button type="primary" @click.native="toPublish(androidConfirmForm.versionType)"  :loading="publishLoading" >确认发布</el-button>
              </div >
            </el-dialog> 
        </Row>
            
    </div>
</template>

<script>
import {getAppList,getExtendList,getApiList,versionList,getMarketList,editApi,getApplicationTypeList,updateVersion,createApi,createVersion,addApp,editApp,deleteApi } from '../../api/api';

const systemOptions = ['Web', 'IOS', 'Android','IOS+Android'];

// const appTermianl =[{"index":"0","termianl":"Web"},{"index":"2","termianl":"IOS"},{"index":"2","termianl":"Android"},{"index":"3","termianl":"IOS+Android"}];


export default {
  // name: "appmarket_index",
  data() {
    return {
      text:'',
      filters: {
        appCode:'',
				appName: ''
				},
      filters2: {
        version:''
				},
      filters3: {
        version:''
				},
      filters4: {
        version:''
				},
      tableData: [],
      apiTableList:[],
      webTableList:[],
      webLists:[],
      iosTableList:[],
      androidTableList:[],
			total: 0,
      pageNum: 1,
      pageSize:2,
			apiTotal: 0,
      apiPageNum: 1,
      apiPageSize:2,
			webTotal: 0,
      webPageNum: 1,
      webPageSize:2,
			iosTotal: 0,
      iosPageNum: 1,
      iosPageSize:2,
			androidTotal: 0,
      androidPageNum: 1,
      androidPageSize:2,
			listLoading: false,
			apiListLoading: false,
			webListLoading: false,
			iosListLoading: false,
			androidListLoading: false,
			publishLoading: false,
			sels: [],//列表选中列
      listInfo: [],
      market:[],
      clazz:[],
      // checkBox:[{"index":"0","termianl":"Web"},{"index":"2","termianl":"IOS"},{"index":"2","termianl":"Android"},{"index":"3","termianl":"IOS+Android"}],
      activeName: 'first',
      activeTab: 'first',
      checkedSystems1: [],
      systems: systemOptions,
      editLoading: false,
      
      versionDialogVisible: false,
      editdialogVisible:false,

      appDialogVisible: false,//新增界面是否显示
      apiDialogVisible:false,//api新增弹框
      apiEditDialogVisible:false,//弹框
      webDialogVisible:false,//
      webConfirmDialogVisible:false,//web信息确认弹框
      iosDialogVisible:false,//
      iosConfirmDialogVisible:false,
      androidDialogVisible:false,//
      androidConfirmDialogVisible:false,
      webDetailDialogVisible:false,
      iosDetailDialogVisible:false,
      androidDetailDialogVisible:false,
      addLoading: false,
      modal16: false,
      apiEditModal:[],
      
      addFormRules: {
					appCode: [
						{ required: true, message: '请输入应用名称', trigger: 'blur' }
					],
					appName: [
						{ required: true, message: '请输入应用编码', trigger: 'blur' },
            { min: 1, max: 10, message: '长度在 1 到 10 个字符', trigger: 'blur' }
					],
        },
        addForm: {
					appCode:'',
					appName: '',
					appMarket: '',
					appType: ''
        },
        apiForm: {
          appCode:'',
					apiName:'',
					apiAddrss: '',
					gatewayAddrss: ''
        },
        apiTab: {
          appCode:'',
					apiName:'',
					apiAddrss: '',
					gatewayAddrss: ''
        },
        versionTab:{
          appCode:'',
        },
        apiEditForm: {
          appCode:'',
					apiName:'',
					apiAddrss: '',
					gatewayAddrss: ''
        },
        apiFormRules: {
					apiName: [
						{ required: true, message: '请输入API接口名称', trigger: 'blur' }
					],
					gatewayAddrss: [
						{ required: true, message: '请输入网关地址', trigger: 'blur' }
					],
        },
        webForm: {
          appCode:'',
					version:'',
					defaultPackage: 1,
					isRelyOnColud: 0,
					winType: '',
					urlNum: '',
					accessUrl: '',
					versionType: '',
					remark: ''
        },
        webDetailForm: {
          appCode:'',
					version:'',
					defaultPackage: '',
					isRelyOnColud: '',
					winType: '',
					urlNum: '',
					accessUrl: '',
					versionType: '',
					remark: ''
        },
        webFormRules: {
					version: [
						{ required: true, message: '请输入', trigger: 'blur' }
					],
					gatewayAddrss: [
						{ required: true, message: '请输入网关地址', trigger: 'blur' }
					],
        },
        webConfirmForm: {
					appCode:'',
					appName:'',
					appMarket:'',
					appType:'',
					version:'',
					defaultPackage: '',
					winType: '',
					remark: ''
        },
        iosForm: {
					version:'',
					compile: '',
					forceUpdate: '',
					isDefaultInstall: '',
					validateType: '',
					frameType: '',
					forceUpdate: '',
					installPackageUrl: '',
					accessUrl: '',
					startupConfig: '',
					extendConfig: '',
					remark: ''
        },
        iosDetailForm: {
					version:'',
					compile: '',
					forceUpdate: '',
					isDefaultInstall: '',
					validateType: '',
					frameType: '',
					forceUpdate: '',
					installPackageUrl: '',
					accessUrl: '',
					startupConfig: '',
					extendConfig: '',
					remark: ''
        },
        iosFormRules: {
					version: [
						{ required: true, message: '请输入', trigger: 'blur' }
					],
					gatewayAddrss: [
						{ required: true, message: '请输入网关地址', trigger: 'blur' }
					],
        },
        iosConfirmForm: {
					appCode:'',
					appName:'',
					appMarket:'',
					appType:'',
					version:'',
					defaultPackage: '',
					winType: '',
					remark: ''
        },
        androidForm: {
					version:'',
					compile: '',
					forceUpdate: '',
					isDefaultInstall: '',
					validateType: '',
					frameType: '',
					forceUpdate: '',
					installPackageUrl: '',
					accessUrl: '',
					startupConfig: '',
					extendConfig: '',
					remark: ''
        },
        androidDetailForm: {
				version:'',
					compile: '',
					forceUpdate: '',
					isDefaultInstall: '',
					validateType: '',
					frameType: '',
					forceUpdate: '',
					installPackageUrl: '',
					accessUrl: '',
					startupConfig: '',
					extendConfig: '',
					remark: ''
        },
        androidConfirmForm: {
					appCode:'',
					appName:'',
					appMarket:'',
					appType:'',
					version:'',
					defaultPackage: '',
					winType: '',
					remark: ''
        },
        androidFormRules: {
					version: [
						{ required: true, message: '请输入', trigger: 'blur' }
					],
					gatewayAddrss: [
						{ required: true, message: '请输入网关地址', trigger: 'blur' }
					],
        },
        editForm: {
					appCode: '',
					appName: '',
					market: '',
          applicationType: '',
          appSource:'',
          logoImage:'',
          developer:'',
          recommend:'',
          sort:'',
          remark:'',
        },
        editFormRules: {
					appName: [
						{ required: true, message: '请输入应用名称', trigger: 'blur' }
					],
					recommend: [
						{ required: true, message: '请选择是否推荐', trigger: 'blur' }
					],
				},
        extendForm: {
					id: '',
					appCode: '',
					appTerminal: [],
					accessControl: -1,
          isEnable: '',
          isDefault:'',
          isPreInstall:'',
          attachment:'',
          detailImage:'',
          updateDate:'',
        },
        extendFormRules: {
					appName: [
						{ required: true, message: '请输入应用名称', trigger: 'blur' }
					],
					appMarket: [
						{ required: true, message: '请选择市场', trigger: 'blur' }
          ],
           appTerminal: [
            // { type: 'array', required: true, message: '请至少选择一个', trigger: 'change' }
          ],
					recommend: [
						{ required: true, message: '请选择是否推荐', trigger: 'blur' }
					],
				},



        formLabelWidth: '120px'

    };
  },
  methods: {
    formatIsSynchro: function (row, column) {
				return row.isSynchro == 1 ? '是' : row.isSynchro == 0 ? '否' : '未知';
			},
			formatIsEnable: function (row, column) {
				return row.isEnable == 1 ? '是' : row.isEnable == 0 ? '否' : '未知';
			},
			formatCurrentVersion: function (row, column) {
				return row.currentVersion == 1 ? '是' : row.currentVersion == 0 ? '否' : '';
			},
			formatVersion: function (row, column) {
				return row.versionType == 1 ? 'Web' : row.versionType == 2 ? 'IOS' : row.versionType == 3 ? 'Android':'';
			},
    handleClose(done) {
            this.$confirm('确认关闭？')
            .then(_ => {
                done();
            })
            .catch(_ => {});
        },
        handleClick(tab, event) {
            console.log(tab, event);
        },
        asyncOK () {
            this.modal6 = false;
        },
    handleCurrentPageChange: function (pageNum) {// 翻页动作
        this.pageNum = pageNum;
        this.getList();// 翻页后刷新页面数据
    },
    handleCurrentAPiPageChange: function (apiPageNum) {// 翻页动作
        this.apiPageNum = apiPageNum;
        this.apiList();// 翻页后刷新页面数据
    },
    handleCurrentWebPageChange: function (webPageNum) {// 翻页动作
        this.webPageNum = webPageNum;
        this.webList();// 翻页后刷新页面数据
    },
    handleSwitch(lang) {
      this.lang = lang;
      localStorage.lang = lang;
      this.$store.commit("switchLang", lang); // 如果你要自己实现多语言切换，那么只需要执行这行代码即可，修改语言类型

      this.columnsI18n = [
        {
          key: "name",
          title: this.$t("name")
        },
        {
          key: "company",
          title: this.$t("company")
        }
      ]; // 像iview的table组件这样一次渲染如果数据不更新视图就不更新的组件，如果切换语言需要更新一下数据才能切换组件内的多语言
    },
        //显示完善资料界面
    appEdit: function (index, row) {
      this.editdialogVisible = true;
      this.editForm = Object.assign({}, row);
      this.extendForm = Object.assign({}, row.extendMap);
      console.log(row.extendMap);
      this.apiTab.appCode = row.appCode;
      this.apiList();
    },
    //编辑api
    tabEdit: function (index, row) {
    this.modal16 = true;
      // let flag = true;
      // this.apiEditdialogVisible = flag;
      this.apiEditForm = Object.assign({}, row);
      // this.extendForm = Object.assign({}, row.extendMap);
      // this.apiForm.appCode = Object.assign({},row.appCode);
    },
    versionEdit: function (index, row) {//版本信息弹框
      this.versionDialogVisible = true;
      this.versionTab = Object.assign({}, row);
      this.versionTab.appCode= row.appCode;
      this.webList();
      this.iosList();
      this.androidList();
    },
    appAdd:function(){
				this.addForm = {
					appCode: '',
					appName: '',
					appMarket: '',
					appType: ''
				
				};
        this.marketlist();
        this.classlist();
        this.appDialogVisible = true;

      },
    apiAdd:function(){
        this.apiDialogVisible = true;
				this.apiForm = {
          appCode:'',
					apiName: '',
					apiAddrss: '',
					gatewayAddrss: ''
				
				};

      },
    webAdd:function(){
        this.webDialogVisible = true;
				this.webForm = {
					version: '',
					defaultPackage: '',
					winType: '',
					isRelyOnColud: '',
					accessUrl: '',
					urlNum: '',
					remark: '',
				
				};

      },
    webConfirm:function(){
      let params = Object.assign({}, this.webForm);
        params.appCode  = this.versionTab.appCode;
        params.versionType = "1";
        createVersion(params).then((res) => {
              //NProgress.done();
              this.webConfirmForm = {
              id:'',
              appCode: '',
					    appName: '',
					    appMarket: '',
					    appType: '',
					    logoImage: '',
					    attachment: '',
					    remark: '',
					    version: '',
					    winType: '',
					    accessUrl: ''
        };
        this.submitWeb(params);
			});
      },
      submitWeb(_params){
        let _this = this;
          let params ={
           appCode:_params.appCode,
           versionType:_params.versionType,
           version:_params.version
        }
        versionList(params).then(function(result){
          if(result.data.list.length > 0){
              let re = result.data.list[0];
              _this.webConfirmForm = re;
          }
        })
        this.webConfirmDialogVisible = true;
      },
    iosAdd:function(){
        this.iosDialogVisible = true;
				this.iosForm = {
					version: '',
					compile: '',
					forceUpdate: '',
					isDefaultInstall: '',
					validateType: '',
					frameType: '',
					installPackageUrl: '',
					installPackage: '',
					installPackageSize: '',
					accessUrl: '',
					startupConfig: '',
					extendConfig: '',
					remark: ''
				
				};

      },
    iosConfirm:function(){
      let params = Object.assign({}, this.iosForm);
        params.appCode  = this.versionTab.appCode;
        params.versionType = "2";
        createVersion(params).then((res) => {
            //NProgress.done();
            this.iosConfirmForm = {
            id:'',
            appCode: '',
            appName: '',
            appMarket: '',
            appType: '',
            logoImage: '',
            attachment: '',
            remark: '',
            attachment: '',
            version: '',
            installPackageUrl: '',
            installPackage: '',
            accessUrl: ''
        };
        this.submitIOS(params);
			});
      },
       submitIOS(_params){
        let _this = this;
          let params ={
           appCode:_params.appCode,
           versionType:_params.versionType,
           version:_params.version
        }
        versionList(params).then(function(result){
          if(result.data.list.length > 0){
              let re = result.data.list[0];
              _this.iosConfirmForm = re;
          }
        })
        this.iosConfirmDialogVisible = true;
      },
    androidAdd:function(){
        this.androidDialogVisible = true;
				this.androidForm = {
					version: '',
					compile: '',
					forceUpdate: '',
					isDefaultInstall: '',
					validateType: '',
					frameType: '',
					installPackageUrl: '',
					installPackage: '',
					installPackageSize: '',
					accessUrl: '',
					startupConfig: '',
					extendConfig: '',
					remark: ''
				
				};

      },
    androidConfirm:function(){
       let params = Object.assign({}, this.androidForm);
        params.appCode  = this.versionTab.appCode;
        params.versionType = "3";
        createVersion(params).then((res) => {
            //NProgress.done();
           this.androidConfirmForm = {
              id:'',
              appCode: '',
              appName: '',
              logoImage: '',
              appMarket: '',
              appType: '',
              remark: '',
              attachment: '',
              version: '',
              installPackageUrl: '',
              installPackage: '',
              accessUrl: ''
				
				};
        this.submitAndroid(params);
			});
      },
      submitAndroid(_params){
        let _this = this;
          let params ={
           appCode:_params.appCode,
           versionType:_params.versionType,
           version:_params.version
        }
        versionList(params).then(function(result){
          if(result.data.list.length > 0){
              let re = result.data.list[0];
              _this.androidConfirmForm = re;
          }
        })
        this.androidConfirmDialogVisible = true;
      },
			getList() {
				let params = {
					pageNum: this.pageNum,
          pageSize:this.pageSize,
					appCode: this.filters.appCode,
					appName: this.filters.appName
				};
				this.listLoading = true;
				//NProgress.start();
				getAppList(params).then(function(result){
          this.tableData = result.data.list;
          this.pageNum = result.data.pageNum;
          this.pageSize = result.data.pageSize;
					this.total = result.data.total;
					this.listLoading = false;
				}.bind(this)).catch(function (error) {
					this.listLoading = false;
					console.log(error);
				}.bind(this));
      },
      //获取api列表
			apiList() {
				let params = {
					pageNum: this.apiPageNum,
          pageSize:this.apiPageSize,
           appCode:this.apiTab.appCode
				
					// appName: this.editForm.appName
        };
        this.apiListLoading = true;
				getApiList(params).then(function(result){
          this.apiTableList = result.data.list;
          this.apiPageNum = result.data.pageNum;
          this.apiPageSize = result.data.pageSize;
					this.apiTotal = result.data.total;
					this.apiListLoading = false;
				}.bind(this)).catch(function (error) {
					this.apiListLoading = false;
					console.log(error);
				}.bind(this));
      },
      apiEditSubmit: function () {
				this.$refs.apiEditForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => {
							this.editLoading = true;
							//NProgress.start();
              let params = Object.assign({}, this.apiEditForm);
							editApi(params).then((res) => {
								this.editLoading = false;
								//NProgress.done();updateDate
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$refs['apiEditForm'].resetFields();
								this.modal16 = false;
								this.apiList();
							});
						});
					}
				});
      },
      toPublish: function (para) {
				// this.$refs.apiEditForm.validate((valid) => {
					// if (valid) {
						this.$confirm('确认发布吗？', '提示', {}).then(() => {
							this.publishLoading = true;
              //NProgress.start();
              let form;
              if(para==1){
                form = Object.assign({}, this.webConfirmForm);
              }else if(para == 2){
                form = Object.assign({}, this.iosConfirmForm);
              }else{
                form = Object.assign({}, this.androidConfirmForm);

              }
              let params = {
                publish:1,
                id:form.id
              }
							updateVersion(params).then((res) => {
								this.publishLoading = false;
								//NProgress.done();updateDate
								this.$message({
									message: '发布成功',
									type: 'success'
								});
								// this.$refs['apiEditForm'].resetFields();
                if(para==1){
								this.webConfirmDialogVisible = false;
                this.webForm = false;
                this.webList();
                }else if(para == 2){
                  this.iosConfirmDialogVisible = false;
                }else{
                  this.androidConfirmDialogVisible = false;
                }
								// this.apiList();
							});
						});
					// }
				// });
      },
      putDown(index, row){
        //直接下架
        this.$confirm('确认下架 '+row.version+' 当前版本？', '提示', {}).then(() => {
          let data = Object.assign({},row);
          let params ={
            id:data.id,
            currentVersion:0,
          }
          console.log(params)
          updateVersion(params).then((res) => {
             this.webListLoading = false;
             //NProgress.done();updateDate
             this.$message({
               message: '下架成功',
               type: 'success'
             });
           });
        });
      },
      check(index,row){
        //查询当前应用是否已有版本上架
        let data = Object.assign({},row);
        let params ={
          appCode:data.appCode,
          versionType:data.versionType,
          currentVersion:1,
        }
        versionList(params).then((res) =>{
          let size = res.data.list.length;
          // console.log(res)
          // console.log(size)
          if(size==0){
            this.putUP(index,row)
          }else{
             this.$alert('请先下架当前版本'),{
                confirmButtonText: '确定',
             }
          }
        });
      },
      putUP(index, row){
        this.$confirm('确认是否将'+row.version+'版本设置为当前版本？', '提示', {}).then(() => {
          let data = Object.assign({},row);
          let params ={
            id:data.id,
            currentVersion:1,
          }
          // console.log(params)
          updateVersion(params).then((res) => {
             this.webListLoading = false;
             //NProgress.done();updateDate
             this.$message({
               message: '下架成功',
               type: 'success'
             });
           });
        });
      },
      marketlist(){
        let params = {marketName:''};
        getMarketList(params).then(function(result){
          this.market = result.data.list;
        }.bind(this)).catch(function (error) {
					console.log(error);
				}.bind(this));

      },
      classlist(){
        let params = {className:''};
        getApplicationTypeList(params).then(function(result){
          this.clazz = result.data.list;
        }.bind(this)).catch(function (error) {
					console.log(error);
				}.bind(this));

      },
      	webList() {
				let params = {
					pageNum: this.webPageNum,
          pageSize:this.webPageSize,
					appCode:this.versionTab.appCode,
          version: this.filters2.version,
          versionType:1
				};
				this.webListLoading = true;
        //NProgress.start();
				versionList(params).then(function(result){
          this.webTableList = result.data.list;
          this.webPageNum = result.data.pageNum;
          this.webPageSize = result.data.pageSize;
					this.webTotal = result.data.total;
					this.webListLoading = false;
				}.bind(this)).catch(function (error) {
					this.webListLoading = false;
					console.log(error);
				}.bind(this));
      },
      	iosList() {
				let params = {
					pageNum: this.iosPageNum,
          pageSize:this.iosPageSize,
					appCode:this.versionTab.appCode,
          version: this.filters3.version,
          versionType:2
				};
				this.iosListLoading = true;
        //NProgress.start();
				versionList(params).then(function(result){
          this.iosTableList = result.data.list;
          this.iosPageNum = result.data.pageNum;
          this.iosPageSize = result.data.pageSize;
					this.iosTotal = result.data.total;
					this.iosListLoading = false;
				}.bind(this)).catch(function (error) {
					this.iosListLoading = false;
					console.log(error);
				}.bind(this));
      },
      	androidList() {
				let params = {
					pageNum: this.androidPageNum,
          pageSize:this.androidPageSize,
					appCode:this.versionTab.appCode,
          version: this.filters4.version,
          versionType:3
				};
				this.androidListLoading = true;
        //NProgress.start();
				versionList(params).then(function(result){
          this.androidTableList = result.data.list;
          this.androidPageNum = result.data.pageNum;
          this.androidPageSize = result.data.pageSize;
					this.androidTotal = result.data.total;
					this.androidListLoading = false;
				}.bind(this)).catch(function (error) {
					this.androidListLoading = false;
					console.log(error);
				}.bind(this));
      },
      addSubmit: function () {
				this.$refs.addForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => {
							this.addLoading = true;
							//NProgress.start();
              let params = Object.assign({}, this.addForm);
							addApp(params).then((res) => {
								this.addLoading = false;
								//NProgress.done();
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$refs['addForm'].resetFields();
								this.appDialogVisible = false;
								this.getList();
							});
						});
					}
				});
      },
      view:function(index, row){
        // console.log(row);
        if(row.versionType==1){
          this.webDetailDialogVisible = true ;
          this.webDetailForm = Object.assign({}, row);
        }else if(row.versionType==2){
          this.iosDetailDialogVisible = true ;
          this.iosDetailForm = Object.assign({}, row);
        }else{
          this.androidDetailDialogVisible = true ;
          this.androidDetailForm = Object.assign({}, row);

        }

      },
      saveApi: function () {
				this.$refs.apiForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => {
							this.addLoading = true;
							//NProgress.start();
              let params = Object.assign({}, this.apiForm);
              // params.appCode  = this.apiTab.appCode;
              params.appCode  = this.extendForm.appCode;
							createApi(params).then((res) => {
								this.addLoading = false;
								//NProgress.done();
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$refs['apiForm'].resetFields();
								this.apiDialogVisible = false;
								this.apiList();
							});
						});
					}
				});
      },
      saveWeb: function () {
				this.$refs.webForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => {
							this.addLoading = true;
							//NProgress.start();
              let params = Object.assign({}, this.webForm);
              params.appCode  = this.versionTab.appCode;
              params.versionType = "1";
							createVersion(params).then((res) => {
								this.addLoading = false;
								//NProgress.done();
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$refs['webForm'].resetFields();
                this.webDialogVisible = false;
                this.webList();
							});
						});
					}
				});
      },
      saveIOS: function () {
				this.$refs.iosForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => {
							this.addLoading = true;
							//NProgress.start();
              let params = Object.assign({}, this.iosForm);
              params.appCode  = this.versionTab.appCode;
              params.versionType = "2";
							createVersion(params).then((res) => {
								this.addLoading = false;
								//NProgress.done();
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$refs['iosForm'].resetFields();
                this.iosDialogVisible = false;
                this.iosList();
							});
						});
					}
				});
      },
      saveAndroid: function () {
				this.$refs.androidForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => {
							this.addLoading = true;
							//NProgress.start();
              let params = Object.assign({}, this.androidForm);
              params.appCode  = this.versionTab.appCode;
              params.versionType = "3";
							createVersion(params).then((res) => {
								this.addLoading = false;
								//NProgress.done();
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$refs['androidForm'].resetFields();
                this.androidDialogVisible = false;
                this.androidList();
							});
						});
					}
				});
      },
      editSubmit: function () {
				this.$refs.editForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => {
							this.editLoading = true;
							//NProgress.start();
              let params = Object.assign({}, this.editForm);
              console.log(params)
              let tst = "Android,IOS";
              params.extendMap = Object.assign({}, this.extendForm);
              params.extendMap.app_termianl = tst;
              params.createDate = Date.parse(new Date(params.createDate));
              params.updateDate = Date.parse(new Date(params.updateDate));
              params.updateDate = Date.parse(new Date(params.extendMap.updateDate));
							editApp(params).then((res) => {
								this.editLoading = false;
								//NProgress.done();updateDate
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$refs['editForm'].resetFields();
								this.editdialogVisible = false;
								this.getList();
							});
						});
					}
				});
      },
      apiDelete: function (index, row) {
				this.$confirm('确认删除该记录吗?', '提示', {
					type: 'warning'
				}).then(() => {
					this.listLoading = true;
					//NProgress.start();
          let params = {id:row.id};
					deleteApi(params).then((res) => {
						this.listLoading = false;
						//NProgress.done();
						this.$message({
							message: '删除成功',
							type: 'success'
						});
						this.apiList();
					});
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消删除'
					}); 
				});
			},
      
      // handleRemove(file, fileList) {
      //   console.log(file, fileList);
      // },
      // handlePreview(file) {
      //   console.log(file);
      // },
      // handleExceed(files, fileList) {
      //   this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
      // },
      // beforeRemove(file, fileList) {
      //   return this.$confirm(`确定移除 ${ file.name }？`);
      // },
     handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      }
      //  open3() {
      //   this.$prompt('请输入邮箱', '提示', {
      //     confirmButtonText: '确定',
      //     cancelButtonText: '取消',
      //     inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
      //     inputErrorMessage: '邮箱格式不正确'
      //   }).then(({ value }) => {
      //     this.$message({
      //       type: 'success',
      //       message: '你的邮箱是: ' + value
      //     });
      //   }).catch(() => {
      //     this.$message({
      //       type: 'info',
      //       message: '取消输入'
      //     });       
      //   });
      // }
  },
  computed: {
    placeholderText() {
      return this.$t("placeholderText");
    },
    placeholderDate() {
      return this.$t("placeholderDate");
    }
  },
  created() {
    this.lang = localStorage.lang || "zh-CN";
  },
  mounted(){
    this.getList();
    // var _this = this
    // this.$http.get('http://localhost:8764/appBaseInfo')
    //     .then(function (response) {
    //       console.log(response);
    //       _this.listInfo = response.data.data;

    //     })
    //     .catch(function (error) {
    //       console.log(error);
    //     });

    // this.$http.post('http://localhost:8762/market/appList/marketList')
    // .then(function(response){
    //   for(var item of response.data){
    //     _this.marketIndex=item.marketCode
    //     _this.marketList.push({
    //       market:item.marketName
    //     })
    //   }
    //   console.log(response);
    //   // console.log(response);
    //   // _this.marketList = response.data;
    // })
    //  .catch(function (error) {
    //       console.log(error);
    //     });
  }
//http://localhost:8762/market/appList/marketList
};
</script>
